package com.xml.jaxb;

import java.io.File;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;

public class ConvertXmlToObject {

	public static void main(String[] args) {

		try {

			File file = new File(System.getProperty("user.dir")+"/xml/jaxb/objecttoxml.xml");
			JAXBContext jaxbContext = JAXBContext.newInstance(Customer.class);

			Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
			Customer customer = (Customer) jaxbUnmarshaller.unmarshal(file);
			System.out.println(customer.getName());

		} catch (JAXBException e) {
			e.printStackTrace();
		}

	}

}
